
<?php
session_start();

mysql_connect("localhost","root","test") or die ("sorry..");
mysql_select_db("login");
$username = $_POST['username'];
$passwd = $_POST['passwd'];

$qry ="select * from login_master where username='". $username ."' and passwd='". $passwd ."'";
$rs= mysql_query($qry);

if($rs)
 {
  $i=0;
  while($rs_data=mysql_fetch_array($rs))
  {
  $i++;
   $_SESSION['session_user']=$rs_data["username"];
   }
   if($i>0){
	header("location: login_home.php");
	}
	else{
die("Incorrect user name or password");
	}
}
else
{
die("login failed..................");
} 
?>
